package dao.impl;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import dao.ArticleCommentDao;
import domain.ArticleComment;

public class ArticleCommentImpl implements ArticleCommentDao {

	public boolean deleteArticleComment(ArticleComment ac) {
		Session s = null;
		Transaction tx = null;
		try {
			s = HibernateSessionFactory.getSession();
			tx = s.beginTransaction();
			s.delete(ac);
			s.flush();
			tx.commit();
			return true;
		} finally {
			if (s != null)
				s.close();
		}
	}

	public List findAllArticleCommentByPage(int pageNo, int pageSize) {
		// TODO Auto-generated method stub
		return null;
	}

	public ArticleComment findArticleCommentById(int id) {
		Session s = null;
		try {
			s = HibernateSessionFactory.getSession();
			ArticleComment ac = (ArticleComment) s.get(ArticleComment.class, id);
			return ac;
		} finally {
			if (s != null)
				s.close();
		}
	}

	public long findCount() {
		// TODO Auto-generated method stub
		return 0;
	}

	public boolean saveArticleComment(ArticleComment ac) {
		Session s = null;
		Transaction tx = null;
		try {
			s = HibernateSessionFactory.getSession();
			tx = s.beginTransaction();
			s.save(ac);
			tx.commit();
			return true;
		} finally {
			if (s != null)
				s.close();
		}
	}

	public boolean updateArticleComment(ArticleComment ac) {
		// TODO Auto-generated method stub
		return false;
	}

}
